home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / CodeWarrior Lite / Metrowerks C⁄C++ Lite / Headers / ANSI Headers / yvals.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-14  |  6.2 KB  |  255 lines  |  [TEXT/MMCC]

  1. /* yvals.h values header */
  2. #ifndef _YVALS
  3. #define _YVALS
  4.  
  5. #if __MWERKS__
  6. #pragma options align=mac68k
  7. #endif
  8.  
  9.   /* determine target */
  10. #if defined(__TINY__)||defined(__SMALL__)||defined(__COMPACT__)||\
  11.     defined(__MEDIUM__)||defined(__LARGE__)||defined(__HUGE__)
  12.  #define _INTELx86 1
  13.  #define _MSDOS_C_LIB 1
  14.  #if defined(_MSC)
  15.  #elif __TURBOC__ == 0x0452
  16.   #define _BORLAND40 1
  17.  #else
  18.   #define _BORLAND31 1
  19.  #endif
  20.  
  21. #elif defined(sun)
  22.  #define _INTELx86 0
  23.  #define _POSIX_C_LIB 1
  24.  
  25. #elif defined(__MWERKS__)
  26.  #define _INTELx86 0
  27.  #define _POSIX_C_LIB 0
  28.  #define _C_LIB_IS_EXTERN_C 1
  29.  
  30. #else
  31.  #define _INTELx86 0
  32.  #define _POSIX_C_LIB 1
  33.  #define _PHI_ANALYZER 1
  34. #endif
  35.   /* errno properties */
  36. #define _EDOM 33
  37. #define _ERANGE 34
  38. #define _EFPOS 35
  39. #define _EILSEQ 36
  40. #define _ERRMAX 37
  41.   /* float properties */
  42. #define _DBIAS 0x3fe
  43. #define _DOFF 4
  44. #define _FBIAS 0x7e
  45. #define _FOFF 7
  46. #define _FRND 1
  47. #if _INTELx86 /* little-endian, big long doubles */
  48.  #define _D0 3
  49.  #define _DLONG 1
  50.  #define _LBIAS 0x3ffe
  51.  #define _LOFF 15
  52. #elif defined(sun) /* big-endian, funny long doubles */
  53.  #define _LONG_DOUBLE_HAS_HIDDEN_BIT 1
  54.  #define _D0 0
  55.  #define _DLONG 1
  56.  #define _LBIAS 0x3ffe
  57.  #define _LOFF 15
  58. #else /* big-endian, small long doubles */
  59.  #define _LONG_DOUBLE_HAS_HIDDEN_BIT 1
  60.  #define _D0 0
  61.  #define _DLONG 0
  62.  #define _LBIAS 0x3fe
  63.  #define _LOFF 4
  64. #endif
  65.   /* integer properties */
  66. #define _BITS_BYTE 8
  67. #define _C2   1
  68. #define _CSIGN  1
  69. #define _MBMAX  8
  70. typedef int _Wintt;
  71. #define _WCMIN  0
  72. #define _WCMAX  0xffff
  73. #if _INTELx86 /* 16-bit int */
  74.  #define _ILONG 0
  75. #elif __MWERKS__
  76.  #define _ILONG __fourbyteints__
  77. #else /* 32-bit int */
  78.  #define _ILONG 1
  79. #endif
  80. #define _MAX_EXP_DIG 8 /* for parsing numerics */
  81. #define _MAX_INT_DIG 32
  82. #define _MAX_SIG_DIG 36
  83. #if defined(_BORLAND40) && defined(__cplusplus)
  84.  #define _WCHART  /* wchar_t already built-in */
  85.  typedef wchar_t _Wchart;
  86. #elif __MWERKS__
  87.  typedef char _Wchart;
  88. #else
  89.  typedef unsigned short   _Wchart;
  90. #endif
  91.   /* pointer properties */
  92. #if defined(_BORLAND31) || defined(_BORLAND40)
  93.  #include <_null.h>  /* rules are too complicated to recite here */
  94. #endif
  95.  
  96. #if defined(__HUGE__)||defined(__COMPACT__)||defined(__LARGE__)
  97.  #define _NULL 0L
  98.  #if defined(_BORLAND31) || defined(_BORLAND40)
  99.   typedef long _Ptrdifft;
  100.  #else
  101.   typedef int _Ptrdifft;
  102.  #endif
  103.  typedef unsigned int _Sizet;
  104. #elif __MWERKS__
  105.  #define _NULL 0L
  106.  typedef long _Ptrdifft;
  107.  typedef unsigned long _Sizet;
  108. #else
  109.  #define _NULL 0
  110.  typedef int _Ptrdifft;
  111.  typedef unsigned int _Sizet;
  112. #endif
  113.   /* setjmp properties */
  114. #if _INTELx86
  115.  #define _NSETJMP 10
  116. #else
  117.  #define _NSETJMP 80
  118. #endif
  119. #if _HAS_NO_SETJMP /* should rarely be true */
  120.  #if _USE_EXISTING_SYSTEM_NAMES
  121.   #define _Setjmp setjmp
  122.  #endif
  123.  _EXTERN_C
  124.  int _Setjmp(int *);
  125.  _END_EXTERN_C
  126. #endif /*0*/
  127.   /* signal properties */
  128. #if _INTELx86
  129.  #define _SIGABRT 22
  130. #else
  131.  #define _SIGABRT 6
  132. #endif
  133. #define _SIGMAX  32
  134.   /* stdarg properties */
  135. #if SPARCompiler
  136.  typedef char *_Va_list;
  137.  #ifdef __cplusplus
  138.   extern "C" char __builtin_va_alist;
  139.   extern "C" void *__builtin_va_arg_incr(...);
  140.  #else /* !__cplusplus */
  141.   extern char __builtin_va_alist;
  142.   extern void *__builtin_va_arg_incr();
  143.  #endif  /* __cplusplus */
  144.  #define _Va_start(ap, A) (void)(ap = (char *)&__builtin_va_alist)
  145.  #define _Va_arg(ap, T) ((T *)__builtin_va_arg_incr((T *)ap))[0]
  146. #elif defined(_BORLAND40)
  147.  typedef void __far *_Va_list;/* and use their <stdarg.h> */
  148. #elif __MWERKS__
  149.  typedef char *_Va_list;
  150.  #define _Va_start_addr(A)        (va_list)(&A+1)
  151.  #define _Va_start(ap,A)        (ap=_Va_start_addr(A))
  152.  #define _Va_arg(ap,T)            (*(*(T **)&ap)++)
  153. #else
  154.  typedef char *_Va_list;
  155.  #define _Bnd(X, bnd) (sizeof (X) + (bnd) & ~(bnd))
  156.  #define _Va_arg(ap, T) \
  157.  (*(T *)(((ap) += _Bnd(T, _AUPBND)) - _Bnd(T, _ADNBND)))
  158.  #define _Va_start(ap, A) \
  159.  (void)((ap) = (char *)&(A) + _Bnd(A, _AUPBND))
  160. #endif
  161.   /* stdlib properties */
  162. #define _EXFAIL 1
  163. typedef struct _Mbstatet {
  164.  _Wchart _Wchar;
  165.  char _State;
  166.  } _Mbstatet;
  167.   /* stdio properties */
  168. #define _FNAMAX 64
  169. #ifndef __MWERKS__
  170.  #define _FOPMAX 16
  171. #else
  172.  #define _FOPMAX 64
  173. #endif
  174. #define _TNAMAX 16
  175. typedef struct _Fpost {
  176.  unsigned long _Off; /* can be system dependent */
  177.  _Mbstatet _Wstate;
  178.  } _Fpost;
  179.   /* storage alignment properties */
  180. #if SPARCompiler || defined(_PHI_ANALYZER)
  181.  #define _AUPBND 4U /* sixteen-byte boundaries (2^^4) */
  182.  #define _ADNBND 4U
  183.  #define _MEMBND 4U
  184. #else
  185.  #define _AUPBND 1U /* even-byte boundaries (2^^1) */
  186.  #define _ADNBND 1U
  187.  #define _MEMBND 1U
  188. #endif
  189.   /* time properties */
  190. #if __MWERKS__
  191.  #define _CPS 60
  192.  #define _TBIAS ((4 * 365LU + 1) * 86400)
  193. #else
  194.  #define _CPS 1
  195.  #define _TBIAS ((70 * 365LU + 17) * 86400)
  196. #endif
  197.   /* naming properties */
  198. #define _USE_EXISTING_SYSTEM_NAMES 1 /* _Open => open etc. */
  199. #ifdef __cplusplus
  200.  #define _EXTERN_C extern "C" {
  201.  #define _END_EXTERN_C }
  202. #else
  203.  #define _EXTERN_C
  204.  #define _END_EXTERN_C
  205. #endif /* __cplusplus */
  206. #if defined(__cplusplus) && defined(_C_LIB_IS_EXTERN_C)
  207.  #define _C_LIB_DECL extern "C" {
  208.  #define _END_C_LIB_DECL }
  209. #else
  210.  #define _C_LIB_DECL
  211.  #define _END_C_LIB_DECL
  212. #endif /* __cplusplus && _C_LIB_IS_EXTERN_C */
  213.   /* handle botched widechar constants as need be */
  214. #if defined(sun)||defined(__CENTERLINE__)||defined(_BORLAND31) \
  215.     || defined(__MWERKS__)
  216.  #define _L(c) (c)
  217. #else
  218.  #define _L(c) L##c
  219. #endif
  220.   /* handle botched auto aggregate inits as need be */
  221. #if defined(__CENTERLINE__)
  222.  #define _Mbstinit(x) \
  223.  static mbstate_t _Mbst0; mbstate_t x; x = _Mbst0
  224. #else
  225.  #define _Mbstinit(x)  mbstate_t x = {0}
  226. #endif
  227.   /* handle botched signed char type as need be */
  228. #if defined(_PH_ANALYZER)||defined(_BORLAND40) || defined(__MWERKS__)
  229.  #define _HAS_SIGNED_CHAR 1
  230. #endif
  231.   /* handle botched array-new as need be */
  232. #if defined(_BORLAND40)  /* i.e. implements array-new */
  233.  #define _HAS_ARRAY_NEW 1
  234. #endif
  235.   /* handle botched exceptions as need be */
  236. #if defined(_BORLAND40)  /* i.e. implements exceptions */
  237.  #define _HAS_EXCEPTIONS 1
  238. #endif
  239.  
  240. #if __MWERKS__
  241. #pragma options align=reset
  242. #endif
  243.  
  244. #endif /* _YVALS */
  245.  
  246. /*
  247.  * Copyright (c) 1994 by P.J. Plauger.  ALL RIGHTS RESERVED. 
  248.  * Consult your license regarding permissions and restrictions.
  249.  */
  250. /* Change log:
  251.  *94Oct03 Version received from PlumHall
  252.  *94Oct08 Inserted MW changes.
  253.  *94Oct11MM Added MW definition of _HAS_SIGNED_CHAR
  254.  */
  255.